package com.slz3.business.module.configManagement.conCircle.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conCircle.domain.ConCircle;
import com.slz3.business.module.configManagement.conCircle.domain.ConCircleFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConCircleTransactionalServiceImpl implements ConCircleTransactionalService {

    @Override
    public ConCircle modify(ConCircle conCircleNew) {
        Repositorys.conCircle.test();
        Repositorys.conCircle.save(ConCircleFactory.initBaseFields());
        System.err.println(1/0);
        conCircleNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conCircle.saveAndFlush(conCircleNew);
    }

    @Override
    public List<ConCircle> batchModify(List<ConCircle> conCircleList) {
        return Repositorys.conCircle.saveAll(conCircleList);
    }
}
